<template>
  <div>
    <div>旅游攻略首页</div>
    <div v-for="(item, index) in postList" :key="index">
      {{ item.id }}{{ item.cityName }}
      <span>{{ item.title }}</span>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      postList: []
    };
  },
  created() {
    this.$axios({
      url: "/posts"
    }).then(res => {
      const { data } = res.data;
      console.log(data);
      this.postList = data.map(item => {
        return {
          ...item
        };
      });
      console.log(this.postList);
    });
  }
};
</script>

<style></style>
